<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>${sysName}</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${resRoot}/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="//at.alicdn.com/t/font_tnyc012u2rlwstt9.css" media="all" />
	<link rel="stylesheet" href="${resRoot}/layui/admin/admin.css" media="all" />
	<link id="layuicss-layer" rel="stylesheet" href="${resRoot}/layui/css/modules/layer/default/layer.css" media="all">
</head>
<body class="childrenBody">
	<div class="layui-fluid">   
          <div class="layui-card">
	<div class="layui-form layui-card-header layuiadmin-card-header-auto">
	<div class="layui-form-item">
		<@shiro.hasPermission name="member:show">
		<div class="layui-inline">
	    <label class="layui-form-label">昵称/手机号</label>
	    <div class="layui-input-block">
	    <input type="text" name="name" id="name" value="<#if name??>${name}</#if>"  placeholder="昵称/手机号" class="layui-input">
	    </div>
	  </div>
		
		<div class="layui-inline">
		    <a class="layui-btn search_btn">查询</a>
		</div>
		</@shiro.hasPermission>
	</div>
	</div>
	
	
	<div class="layui-card-body">
	
	
	<div class="layui-form news_list">
	  	<table class="layui-table">
		    <colgroup>
				<col>
				<col>
				<col>
				<col>
				<col>
				<col>
		    </colgroup>
		    <thead>
				<tr>
					<th style="text-align:left;">序号</th>
					<th>昵称</th>
					<th>电话</th>
					<@shiro.hasPermission name="member:test">
					<th>token</th>
					</@shiro.hasPermission>
					<th>头像</th>
					<th>性别</th>
					<th>状态</th>
					<th>创建时间</th>
					<th>操作</th>
				</tr>
		    </thead>
		    <tbody>
		    <@shiro.hasPermission name="member:show">
		    	<#list result.datas as memberDTO>
		    	<tr>
					<td style="text-align:left;">${(result.pageNumber - 1)*result.pageSize + memberDTO_index +1}</td>
					<td>${memberDTO.nickName}</td>
					<td>${memberDTO.tel}</td>
					<@shiro.hasPermission name="member:test">
					<td>${memberDTO.token!}</td>
					</@shiro.hasPermission>
					<td><img src="${memberDTO.headPic!}" style="max-width:20px;max-height:20px;" /></td>
					<td>${dictMap['member_sex'][memberDTO.sex]}</td>
					<td>${dictMap['member_state'][memberDTO.state]}</td>
					<td>${memberDTO.createTime?datetime}</td>
					<td>
					<@shiro.hasPermission name="member:show">
					<a class="layui-btn layui-btn-normal layui-btn-xs" href="${base}/sys/member/detial?id=${memberDTO.id}"><i class="iconfont icon-edit"></i>查看</a>
					</@shiro.hasPermission>
					<@shiro.hasPermission name="member:reset">
					<a class="layui-btn layui-btn-normal layui-btn-xs" href="javascript:void(0);" onclick="memberReset(${memberDTO.id});" ><i class="iconfont"></i>重置密码</a>
					</@shiro.hasPermission>
					<@shiro.hasPermission name="member:point">
					<a class="layui-btn layui-btn-normal layui-btn-xs" href="${base}/sys/point/show?memberId=${memberDTO.id}"  ><i class="iconfont"></i>积分</a>
					</@shiro.hasPermission>
					<@shiro.hasPermission name="member:del"> 
		        		<a class="layui-btn layui-btn-danger layui-btn-xs" href="javascript:void(0);" onclick="del(${memberDTO.id});" ><i class="layui-icon"></i>删除</a>
		        		</@shiro.hasPermission>
		        	</td>
				</tr>
				</#list>
				</@shiro.hasPermission>
			</tbody>
		</table>
	</div>
	<div id="page"></div>
	</div>
	</div>
	<script type="text/javascript" src="${resRoot}/layui/layui.js"></script>
	<script src="${resRoot}/js/jquery.min.js?v=2.1.4"></script>
	<script src="${resRoot}/layui/layui.all.js" charset="utf-8"></script>
	<#assign pageUrl=base + '/sys/member/show?'>
	<#if name??>
	<#assign pageUrl=pageUrl + 'name='+ name +'&' >
	</#if>
	<#include "/page/page1.html">
	<script>
	$(".search_btn").click(function(){
	var name = $("#name").val();
		  window.location.href='${base}/sys/member/show?name=' + name;
	  });
	
	function memberReset(id) {
		var flag = 0;
			layer.confirm('确定重置密码吗?', function(index){
				$.ajax({
					type : "post",
					url : "${base}/sys/member/resetPassword",
					data : {
						id : id
					},
					dataType : "json",
					async : false,
					success : function(data) {
						flag  = data.message;
						if(flag == 1) {
							layer.msg('重置成功！', {
							  icon: 1,
							  time: 2000 //2秒关闭（如果不配置，默认是3秒）
							}, function(){
								window.location.reload();
							});   
						} else {
							layer.alert("服务器繁忙，请稍候再试！");
						}
					}
				});
			});
	}
	  		function del(id) {
  			var flag = 0;
  			layer.confirm('确定删除该条数据吗?', function(index){
  				$.ajax({
  					type : "post",
  					url : "${base}/sys/member/del",
  					data : {
  						id : id
  					},
  					dataType : "json",
  					async : false,
  					success : function(data) {
  						flag  = data.message;
  						if(flag == 1) {
  							layer.msg('删除成功！', {
  							  icon: 1,
  							  time: 2000 //2秒关闭（如果不配置，默认是3秒）
  							}, function(){
  								window.location.reload();
  							});   
  						} else {
  							layer.alert("服务器繁忙，请稍候再试！");
  						}
  					}
  				});
  			});
  		}
	  		

</script>
</body>
</html>

